package com.lanyam.travel.base.service.impl;


import com.lanyam.travel.base.entity.TravelOrderDetails;
import com.lanyam.travel.base.entity.vo.TravelOrderDetailsVo;
import com.lanyam.travel.base.dao.TravelOrderDetailsMapper;
import com.lanyam.travel.base.service.ITravelOrderDetailsService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;


@Service
@Transactional
@Slf4j
public class TravelOrderDetailsServiceImpl implements ITravelOrderDetailsService {

    @Resource
    private TravelOrderDetailsMapper travelOrderDetailsMapper;

    @Override
    public IPage<TravelOrderDetailsVo> getPageTravelOrderDetails (Map<String, Object> queryMap, Integer page, Integer rows) {
        Page<TravelOrderDetailsVo> pageSize = new Page<TravelOrderDetailsVo>(page, rows);
        Page<TravelOrderDetailsVo> pageInfo = travelOrderDetailsMapper.getPage(pageSize, queryMap);
        return pageInfo;
    }

    @Override
    public void addTravelOrderDetails(TravelOrderDetails travelOrderDetails) {
        travelOrderDetailsMapper.insert(travelOrderDetails);
    }

    @Override
    public void updateTravelOrderDetails(TravelOrderDetails travelOrderDetails) {
        travelOrderDetailsMapper.updateById(travelOrderDetails);
    }

    @Override
    public void delById(String id) {
        travelOrderDetailsMapper.delById(id);
    }

	@Override
	public void batchInsertOrderDetails(List<TravelOrderDetails> orderDetailList) {
		// TODO Auto-generated method stub
		for (TravelOrderDetails travelOrderDetails : orderDetailList) {
			travelOrderDetailsMapper.insert(travelOrderDetails);
		}
	}

}